import Vue from 'vue';
import Router from 'vue-router';
import Layout from '@/layout';
import User from '@/components/user';
import Permission from '@/components/permission';
import Group from '@/components/group';
import System from '@/components/system';

Vue.use(Router);

const constantRoutes = [
  {
    path: '/',
    name: 'index',
    component: Layout,
    children: [
      {
        path: '/system',
        name: 'system',
        component: System
        // components: {
        //   default: User,
        //   group: Group
        // }
      },
      {
        path: '/permission',
        name: 'permission',
        component: Permission
      }
    ]
  }
];

export default new Router({
  mode: 'history', // 去掉url中的#
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
});
